import { useSearchParams, useParams } from "react-router-dom"

const Article = () => {
  // searchparams传参接收
  const [ params ] = useSearchParams()
  const id = params.get('id')
  const name = params.get('name')

  // params传参接收
  const params2 = useParams()
  const id2 = params2.id
  const name2 = params2.name
  return (
    <div>我是文章页面, 
     searchparams传参,传过来的id是 { id }, name是: {name} <br />
     params传参,  传过来的id是 { id2 }, name是: {name2} <br />
    </div>
  )
}

export default Article